import java.util.Scanner;

/**
 * 字符串通配符
 */
public class StringWildcard {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String str1 = scanner.nextLine();
            String str2 = scanner.nextLine();
            str1 = str1.replaceAll("\\?","[0-9a-zA-Z]");
            str1 = str1.replaceAll("\\*","[0-9a-zA-Z]");
            str1 = str1.replaceAll("\\.","\\.");
            System.out.println(str2.matches(str1));
        }
    }
}
